// 属性分组相关操作
import request,{Method} from '@/libs/api.js'

// 获取分组的分页数据
export function getAttrGroupByPage (params) {
    return request({
      url: '/product/attrgroup/getAttrGroupByPage',
      method: Method.POST,
      data: params
    });
}

// 添加分组
export function addGroup (params) {
  return request({
    url: '/product/attrgroup/addGroup',
    method: Method.POST,
    data: params
  });
}

// 修改分组信息
export function editGroup (params) {
  return request({
    url: '/product/attrgroup/editGroup',
    method: Method.PUT,
    data: params
  });
}

// 删除分组
export function deleteGroup (id) {
  return request({
    url: `/product/attrgroup/deleteGroup/${id}`,
    method: Method.DELETE,
  });
}

// 根据分组的id获取当前的关联
export function getAttrGroupRelationByGroupId (id) {
  return request({
    url: `/product/attrattrgrouprelation/getAttrGroupRelationByGroupId/${id}`,
    method: Method.GET,
  });
}

//根据当前分组的id获取未被当前分组所关联的属性
export function getNoRelationAttrByGroupId (id) {
  return request({
    url: `/product/attrattrgrouprelation/getNoRelationAttrByGroupId/${id}`,
    method: Method.GET,
  });
}

// 添加属性和属性分组的关联关系
export function addToGroup (params) {
  return request({
    url: '/product/attrattrgrouprelation/addToGroup',
    method: Method.POST,
    data: params
  });
}

//根据表id移除关联关系
export function removeRelation (id) {
  return request({
    url: `/product/attrattrgrouprelation/removeRelation/${id}`,
    method: Method.DELETE,
  });
}